class Solution(object):
    def canJump(self, nums):
        n = len(nums)
        max_reach = 0
        for i in range(n):
            # 如果当前位置超过了最远可达位置，无法继续跳跃
            if i > max_reach:
                return False
            # 更新最远可达位置
            max_reach = max(max_reach, i + nums[i])
            if max_reach >= n - 1:
                return True
        return max_reach >= n - 1